from typing import Optional
from datetime import datetime
from decimal import Decimal
from pydantic import BaseModel

class WorkAreaTransactionBase(BaseModel):
    WorkAreaId: int
    TransactionType: str  # deposit/withdraw
    Amount: Decimal
    PaymentMethod: str
    PaymentStatus: str = "pending"  # pending/completed/cancelled
    PaymentTime: Optional[datetime] = None
    Notes: Optional[str] = None

    class Config:
        from_attributes = True

class WorkAreaTransactionCreate(BaseModel):
    TransactionType: str
    Amount: Decimal
    PaymentMethod: str
    Notes: Optional[str] = None

class WorkAreaTransactionUpdate(BaseModel):
    PaymentStatus: str
    PaymentTime: Optional[datetime] = None
    Notes: Optional[str] = None

class WorkAreaTransaction(WorkAreaTransactionBase):
    ID: int
    CreateTime: datetime

    class Config:
        from_attributes = True 